package mx.com.mindbits.bandpay.business;

import mx.com.mindbits.bandpay.dao.ContactsDAO;
import mx.com.mindbits.bandpay.vo.ContactsVO;
import mx.com.mindbits.dao.contacts;
import android.content.Context;

public class ContactsBusiness {
	private ContactsDAO _contactsDao;
	private contacts _contacts;
		
	public ContactsBusiness(Context context){
		_contactsDao = new ContactsDAO(context);
	}
	
	public boolean insertContact(ContactsVO _contactVO){
		_contacts=new contacts();
		_contacts.setId_contact(null);
		_contacts.setContact_name(_contactVO.getNombre());
		_contacts.setContact_email(_contactVO.getEmail());
		_contacts.setId_user(_contactVO.getId_user());
		_contacts.setContact_visible(true);
		
		return _contactsDao.insertContacts(_contacts);
	}
	
	public  boolean updateContact(long id_contact, ContactsVO _contactVO){
		contacts _contact = new contacts();
		_contact.setId_contact(id_contact);	
		_contact.setContact_name(_contactVO.getNombre());
		_contact.setContact_email(_contactVO.getEmail());
		_contact.setId_user(_contactVO.getId_user());
		_contact.setContact_visible(_contactVO.getVisible());
		
		return _contactsDao.updateContacts(_contact);
		
	} 
	
	public boolean deleteContact(long id_contact){
		contacts _contact = new contacts(); 
		
		_contact.setId_contact(id_contact);	
		_contact.setContact_visible(false);
		
		return _contactsDao.deleteContacts(_contact);
	}
	
	
}
